

// 获取队伍列表
import myAxios from "@/request/myAxios.ts";
import {TeamType} from "@/models/Team";

export const getTeamList = (searchText:string,status:number,currentPage:number) => {
    return myAxios.get('/team/list',{
        params: {
            searchText,
            status,
            currentPage
        }
    })
}


// 添加队伍
export const addTeam = (postData:TeamType) => {
    return myAxios.post('team/add',postData)
}

// 更新队伍
export const updateTeam = (postData:TeamType) => {
    return myAxios.post('team/update',postData)
}

// 获取队伍信息
export const getTeamInfo = (id:number) => {
    return myAxios.get('/team/'+id)
}

// 加入队伍
export const joinTeam = (password:string,teamId:number) => {
    return myAxios.post('/team/join', {
        password,
        teamId
    })
}

// 退出队伍
export const quitTeam = (teamId:number) => {
    return myAxios.post('/team/quit', {
        teamId
    })
}

// 解散队伍
export const deleteTeam = (id:number) => {
    return myAxios.post('/team/delete', {
        id
    })
}

// 获取队伍详情
export const getTeamDetail = (id:string) => {
    return myAxios.get('/team/' + id) 
}

// 获取队伍成员
export const getTeamDetailMember = (id:string) => {
    return myAxios.get('/team/member/' + id)
}

// 修改队伍头像
export const getTeamImg = (formData:FormData) => {
    return myAxios.put('/team/cover',formData,{
        headers:{
            'Content-Type': 'multipart/form-data'
        }
        })
}

// 踢出队伍
export const getDelTeamMember = (teamId:string,userId:number) => {
    return myAxios.post('/team/kick',{
        teamId,
        userId
    })

}